<?php
if (!defined('IN_IPB')) exit("<h1>Incorrect access</h1> You may not access this file without the acp.");

class gametype
{
	var $name = "";
	var $card_info = array();
	
	var $ipsclass;
	
	function _xml_to_info(&$xml_class)
	{
		$this->card_info['name'] = $xml_class->xml_array['scratchcardexport']['scratchcard']['card_info']['name']['VALUE'];
		$this->card_info['description'] = $xml_class->xml_array['scratchcardexport']['scratchcard']['card_info']['description']['VALUE'];
		$this->card_info['folder'] = $xml_class->xml_array['scratchcardexport']['scratchcard']['card_info']['folder']['VALUE'];
		$this->card_info['size_width'] = $xml_class->xml_array['scratchcardexport']['scratchcard']['card_info']['size_width']['VALUE'];
		$this->card_info['size_height'] = $xml_class->xml_array['scratchcardexport']['scratchcard']['card_info']['size_height']['VALUE'];
		$this->card_info['card_img'] = $xml_class->xml_array['scratchcardexport']['scratchcard']['card_info']['card_img']['VALUE'];
		$this->card_info['empty_img'] = $xml_class->xml_array['scratchcardexport']['scratchcard']['card_info']['empty_img']['VALUE'];
		$this->card_info['game_type'] = $xml_class->xml_array['scratchcardexport']['scratchcard']['card_info']['game_type']['VALUE'];
		$this->card_info['price'] = 0; //$xml_class->xml_array['scratchcardexport']['scratchcard']['card_info']['price']['VALUE'];
		
		if(!isset($xml_class->xml_array['scratchcardexport']['image_files']['image'][0]) && isset($xml_class->xml_array['scratchcardexport']['image_files']['image']['file']))
		{
			$xml_class->xml_array['scratchcardexport']['image_files']['image'] = array($xml_class->xml_array['scratchcardexport']['image_files']['image']);
		}
		
		$this->card_info['choice_imgs'] = array();
		foreach($xml_class->xml_array['scratchcardexport']['image_files']['image'] as $image)
		{
			$this->card_info['choice_imgs'][] = $image['file']['VALUE'];
		}
		
		if(!isset($xml_class->xml_array['scratchcardexport']['image_location']['location'][0]) && isset($xml_class->xml_array['scratchcardexport']['image_location']['location']))
		{
			$xml_class->xml_array['scratchcardexport']['image_location']['location'] = array($xml_class->xml_array['scratchcardexport']['image_location']['location']);
		}
		
		$this->card_info['choice_info'] = array();
		foreach($xml_class->xml_array['scratchcardexport']['image_location']['location'] as $location)
		{
			$this->card_info['choice_info'][] = array('top'=>$location['top']['VALUE'],'left'=>$location['left']['VALUE'],'width'=>$location['width']['VALUE'],'height'=>$location['height']['VALUE']);
		}
	}
	function admin_form() { return; }
	function admin_save(&$card) { return; }
	function export(&$xml_class) { return; }
	
	// Return 0 not indicate not a win.
	function is_going_to_win() { return 0; }
	
	function create_ticket(&$ticket) { return; }
	
	function create_choices($win = 0) { return array(); }
	function money_reward($win = 0) { return 0; }
	function items_reward($win = 0) { return array(); }
	
	function display_ticket($ticket = array()) { return ""; }
}
?>